package cn.afactory.tygz.model;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by xi on 15/10/11.
 */
public class MoneyShop implements Serializable {
    private static final long serialVersionUID = -2983803043916460264L;

    public  int id;
    public String name;
    public String des;
    public int money;
    public String stock;
    public String pic;


    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public String getStock() {
        return stock;
    }

    public void setStock(String stock) {
        this.stock = stock;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    /**
     * 反序列化函数，用于从json节点对象反序列化本类型实例
     */
    public static MoneyShop deserialize(JSONObject json) throws JSONException {
        if (json != null && json != JSONObject.NULL && json.length() > 0) {
            MoneyShop result = new MoneyShop();

            result.id = json.getInt("id");


           result.name = json.getString("name");
            result.des = json.getString("des");
            result.money = json.getInt("money");
            result.stock = json.getString("stock");
            result.pic = json.getString("pic");


            return result;
        }
        return null;
    }
}
